package com.wuxiaoqin.server.controller;


import com.wuxiaoqin.server.entity.Commodity;
import com.wuxiaoqin.server.entity.Goodsimg;
import com.wuxiaoqin.server.entity.Goodsstock;
import com.wuxiaoqin.server.service.ICommodityService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author jobob
 * @since 2021-10-28
 */
@RestController
@RequestMapping("/commodity")
@ApiOperation("商品操作")
public class CommodityController {

    @Autowired
    private ICommodityService commodityService;

    @ApiOperation("通过Id查询单个商品")
    @GetMapping("/getGoodById")
    public Commodity getGoodById(@RequestParam("id") Integer id){
        return commodityService.getGoodById(id);
    }

    @ApiOperation("通过Id查询的附加图片")
    @GetMapping("/getGoodsImgById")
    public Goodsimg getGoodsImgById(@RequestParam("id") Integer id){
        return commodityService.getGoodsImgById(id);
    }

    @ApiOperation("通过Id查询商品尺码库存")
    @GetMapping("/getGoodsStockById")
    public Goodsstock getGoodsStockById(@RequestParam("id") Integer id){
        return commodityService.getGoodsStockById(id);
    }

}
